Fixed nullpointer issue