Fixed some bugs with stats for ranking task.