added option to save the original buffer
more sync error checking