fixes a potential float and negative value of a segment number