bug fixes with d3 grid code