fixed a nullpointer exception