added validation of port selection