improve port handling in new nib