fixed bug in javascrpt breaking d3.js chart