add archiving to processing of images
fix a few bugs not covered by test