Fixed minor bugs -> tree test passes.