fixed null pointer error for locations