fix a null pointer problem