fix the null pointer problem