Add some error handling for bad data.