fixed locking bug