Fix contracted TR build.
Fix type in error case
Fix TR contracts.