fix sort order of output tree - can't rely on object maps being sorted - fixes #4