fix null pointer from corner case