fix some bugs in mrt code