Compatibility fix for node 0.10.x

Since node 0.10 path.join() throws an exception for non string arguments.
http://nodejs.org/api/path.html#path_path_join_path1_path2

Patched the `toTree` method to filter non string `subdir`