fix bug in visualization.R