Fixed incorrect port number detection