fix buffer synchronization bug
add debugging output option
tabify buffer