Remove undefined in place for the query filter