Added error handling for flat things