Fixes edit. Fixes #167 and #166.