fix null pointer reference