Fix up Rake tasks to properly flush data