modify canCommit method