maybe fix bug writing large amounts of data