implement locking