Fixed locking issue