Fix branches being mixed in Tree structure