fixed error in iterations