Fix crash when binding to a port in use