Fixed bug in sorting when stats are modified/added/deleted