fix next_uncleaned query