fixes and cleanups for text editing