fixes from multiple old tpt++ commits