solving nullpointer issue