Fix to handling errors (non-200 status code)