change the method of finding port