Collection sorting crash fix