Fix bug in retry