fix max retry bug