fix bug where lock/unlock was backward