Fixes to treal and changes to make packaging work