Fix lock initialization

I could not recreate the failure in #235 and therefore cannot write test for this.
Please check code.

@yarondbb 
@genadyp