Fixed behavior of iotype in nested VariableTrees and added a couple of tests

Also added a copy() function to Container that deepcopies all but the parent.