null pointer bug fix