fixed sortOnSpecifity, operator reversed and missing parentheses in comparison condition