Add stats
add generation counter and fix