fix for null pointer check