code cleanup and bug fixes in SHLock