wait how big is buffer_counter when you write out stuff?

shouldn't you do buffer_counter+=num_entries (==number of entries in the sparse vector)