Fix filtering aliases with non-empty sort options

Fixes #2816