Removed CMS::getMaterialsByStructures() joining of gallery table to inner material request, now you should use external handlers to join it, but be carefully, if you join gallery table in outer query, then if yourt material has several gallery records, you will receive multiple rows per this material - one to many relation with gallery table and thought u will cannot use pager correctly, or forced to use group_by, which is very slow and must be avoided at any case.