Fixing bug which causes the chart to be refreshed twice in same cases