added back buffer handling