Fix archiving code.

fixes #7
fixes #4