added fixes to tp code