Passing in datasets named Category and CategoryTop to a query with one or the other as arrays will cause them to start conflict overwriting eachother in the array expansion method due to the $SQL = str_replace line. if :Category is a value and :CategoryTop is an array the :Category token will end up like :__Category__1Top, etc.