Nullpointer exception solved