Fixed d3 issues raised by @chastk in 660bec9d