fixing a bug of "field--package-db..." and refactoring.