fixed bugs and changed test output
    fixed bugs when adding blank tags.
    test output db's data to file instead of terminal