changed the way to get port