fix for-each compilation bug