Fix locking issue