Bug fix: global vars used d3 before loading