better error handling on response