Fixed a bug where traits remained attached to trees