fixed foreach compile error