Fixed response code check

My last patch does not behave nicely when there is no response at all.
This fixes it.