added more port checks