Bug fixes and minor changes to the edit part