writing proper stats
fix write csv