fix main function detection to rely on actually resolved types