fixed bugs and improved text editing