fixing null pointer on location data