Fixed scope issue with edit button