bug fixes for tr