Migrate retry fixes from master