fix bug with special char in password, and if the port is nil