fixed the bug, NEVER nest foreach loops :P