fix null pointer exception problem