fix error messages when checking null objects.
Merge pull request #335 from benelog/master

fix error messages when checking null objects.