More accurate stat tracking in monitor.c

Handle internal_stats in export stats function.