move non-void error check in front of semantic calls