Bug fix: properly change directory in all cases

 * Previously, importing the script in the interpreter would cause the script
   to change to the wrong directory.