fixed some locking