added port detection