Better error handling for data