fix bug on graphs refresh (wrong segment connection between first and last points)