check null pointer exception