Fixes to metatheory and inference