Heterogeneous credit portfolios and the dynamics of theaggregate losses