Heterogeneity, Aggregation and Capital Market Imperfections