Tried to fix locking issues.