Fixed nullpointer error