some dirty port checking code