Prefix was not being propagated in second pass so was only correct at first level where pref == "" Add a test case to validate the fix