fix for memory leak in case !isValidTraversalOrder(order) is true