Fix minibatch construction