Fixed a bug with status code error handling