fixed seriesInsert function