Partial porting of EnsembleECO template and some bug fix