fix to port detection in test engine