Fixed an error in commit method