Fixed a bug in the instantiation of DenseModel