fix the nullpointer exception