Fix archive generation code