fix infloop bug