well, if you need to change the working dir, you need to get the current working dir before that (with ``getcwd()``), not an arbitrary directory. you are not reverting it back, you are changing it to something else