Moved the call to cache.flush() in the function _do_run_calc