adding error handling for null places