Improve tree equality test.