fixed error handling and commit validation