Fixed a null pointer exception bug.