fix null pointer error.