bug fixes for text engine