Wrote initial working code for fix #2 (systemstats memory leak)