handle some edge cases with http codes