Fix port handling in case of string or empty
Fix tests