ported locksync to dosync and some fix