move iteration to the right place