write spec, fix bugs

using #to_i changes the truthiness of the value returned from get_lock