Fix d3 tree click event

Clicking on the d3 tree is not working. This patch should fix this.

The code is not pretty ... (but not much worse)

(I know that the code is mostly taken from http://bl.ocks.org/1093025)

Hope it helps