Fix a crash in the packagetreebuilder and remove test to rebuild it
Fixing tests; they tested a logical error