An intermediate phase stability for high performance of perovskite solar cells