fixed environment issue in xIterate