added some buffer support