pass the original buffer to the user function, for more flexibility