changed lock error handling to a more idomatic go way