optimize ubuf_block implementation