fixed the final iterative bug