fix retry code