do some code clean up. fix xseg callback to only take portno as argument