major overhaul of analyze_fogrun.r with improved error propagation