Fixing bug in the toTree method

Since we use val instead of vars for children's list, we changed our algorithm
to reconstruct subtrees without the uneeded children's list.

This does heavily rely on the case class copy method.