custom implementation of d3 to suppress javascript error in case where x = undefined