fixed a bug in the retry code that was causing an infinite loop