Improved type check to see if it helps with static analysis