Fixed nullpointer exception