bug #664 - move lock to init