added typesafe tid, rid and pid
added typesafy to segmentid