MT#8547 - fix SWITCH inside "foreach" handling