fix error messages when checking null objects.