fixed a bug in visualize.js