fixing nullpointer issue