Check for null instead of None

Fixes #522
Merge pull request #532 from jleclanche/fix-522

Check for null instead of None