added http error status handling