Bug fixes of DBFactory.