Fixed tree comparison, added a few test cases