fixed foreach on empty sets