oops.  move the 'function ctor()' outside the loop.