BUG: fix memory error in sortlevel when many multiindex levels. close #2684