fixed bug in buffer insert and delete. Reworked set-cursor methods. Fixed misc bugs