Fixed bug in function _sortByContrib