updated locking functions