version with buffer