Merge pull request #4 from Mickael-van-der-Beek/valid-tree-index

Use the correct index variable to access the trees array