// fixed locking problem