Fixed a nullpointer exception