solve a null pointer bug