fix period > points.length