Improved error handling for no data returned.