fixed possible nullpointer exception