Fixing some potential memory leaks in computing sample stats.
Making mcmc iterations print to stderr so they don't get captured with stdout logs.