bug fix in edit handler