moved saving stats outside of minimize_io... shouldnt make it too much slower?