added check if port is selected