Fixed bug with port check.