fixed iterator bugs