Fix http response code handling while logging