Fixed massive bug in foreach.