refactored some checks within the lock functions to use lock_do_i_hold