null pointer bug fixed