support sort; skip empty tables