foreach giving me trouble