change api to return buffer instance when callback