Execute scripts with the package's root as working directory in load_code()

- Includes a test

Fixes #640.