fix encode_texpr for TVar
Merge pull request #2437 from frabbit/patch-5

fix encode_texpr for TVar