Fixes cardinality estimation problems around LIMIT