bug fix TR queries