restricting port detection to first run only