fix null pointer error