Fix for use in strict mode

When running with `--use_strict` I got the following error, which this PR fixes: `SyntaxError: In strict mode code, functions can only be declared at top level or immediately within another function.`