refine buffer handler