fix null pointer catching