fixed segCounter and position map not updating correctly