fixed race conditions due to false locking