Fix util.minibatches to work with lists

This fixes minibatches to work even if X and Y are lists.