free old data before assigning new for add_write and add_read. this is currently sorta hacky but will probably get better if we add support for automatically calling destructors