fix lock/unlock and added some tests
Merge pull request #1 from sluu99/master

fix lock/unlock and added some tests