Initializing film homogeneity to retard phase segregation for stable perovskite solar cells