Here is the issue in a jsfiddle:
I forked an existing fiddle from your canjs and replicated the issue.
look at the console output "m" looses its definition.
Remove the the each loop, the problem goes away.
If i remove lines 5-7 of the first section, everything works correctly.
But leaving in lines 5-7(an each loop). once i leave the <% magic tags and enter another set, the variables declared in the first are no longer available in the subsequent magic tags.