Fix bug: restore() doesn't check correct package db when used externally