fixing bugs to ensure compatibility with D3.js V3