Misc bug fixes on the way towards a proper editing interface.