Try to fix the foreach error