Fix workdir
This fixes most of the problems with WorkDir. In particular, the code is now able to restart a calculation. There are still a couple of places where there are inconsistencies, like for the debug files, but that are not critical.
This closes #36 (closed)