Updated possibly working auto port detection

This might work better, I don’t think the other one works at all