Fix retries when using rest out

Raise RuntimeError instead of WriteFail
Add tests
+0.2.0