added restoreBuffer