Bugfix: reworked the retry logic