Fixed exception handling for http codes 500 and above.