Replace as_c_str method by as_imm_buf to convert str to c_str