Fixed null pointer bug.
null pointer bug