fixed bug in dtree implementation, more robust test framework