Fix retry function