Fixed locking problem