fixed some weird locking issue