trying to fix foreach