Fix bugs in json_mapper; and command line interface to pkgmgr