Correct cleaning of valid ids in QueryCDB