Fixed Nullpointer exception