Fixed bugs in processMap() and packageArchive() and added sanity checks