Bug fix: corrected retry condition