Fixed type checking bug

There was a bug in the new type checking logic, where a test against
null was performed instead of = 0.