core: restore for-each loop over array