Preventing gelation in polyisoimide synthesis