Bugfix in createTree