Make arrays work in foreach