Fix to get port number of server
Solve some error messages