bug fix for tref