Fix issues in stats collection