editor: several bug fixes