properly parse port