foreach fix