tweaked the retry mechanism