add check for invalid port