process and fixing d3.js generate code