Fixes important issue when searching for a free port.