Null checking. Fixes #5