takes custom port numbers into account