fix a nullpointer exception