fixes #4833 fixes js error when adding new segment