fixed D3 implementation