core: fix type inference for phi nodes
core: fix processing try/catch in loop