Move monkey patching to every executable file's heading.

Apparently it doesn't work as expected if it's inside an imported module.