Replace debug stage with stats unit