fixes GH-784 and GH-786
improve fix for GH-786 plus test it and also backoff
Merge pull request #788 from mokesmokes/exponentialBackoff

fixes #784 and #786