Bug fix for edit method