More tests and fix format for writing archives