fixed tab sorting bugs