fixed small bug checking for port