bug fix for edit mode