Fix error hanling in requests