Only pass port if it is not nil