added support for servers with an diffrent external port