Fix logic around incorrect tree comparison.