changed to use new res_buf interface