Fix collection type query generation