Bug fix in trex