fix for #10

not quite ready for merge - in the AMD/UMD case, would be good to recognise where we can do a straight return rather than storing the function in a temporary `__export` variable