simplified ImportLeaf sorting
also fixed a bug in detecting mixed case leafs