some fixes to type resolution