refine http error checks