fixing some memory issues with using existing data