speed up minibatching