fixed crash when buffer was modified