fixed two compilation errors, refactored creation of host:port string into separate function get_host_port