Small fix in buf callback functions