Several bugfixes and improvements.

Please review the changes. My pull request also contains changes already submitted in https://github.com/webworka/Tagedit/pull/35