Fix the cancel check and add is_edit method