LS Create Replica Stub

i am searching for a lotus script code to create replica stubs.

i used the code example from openntf:

http://www.openntf.org/projects/codebin/codebin.nsf/0/8F65FB90759865E888256BDC000CBF40

but with this code my client (8.5.1 FP3) mostly crashes in line:

rc = OS2_NSFDBREPLICAINFOSET(dbhandle, replInfo(0))

any other suggestions to create replica stubs?