locking works correctly now