Both, flour and cornstarch, are suitable for thickening your pie filling. Cook the flour in butter so it is not raw anymore. Cornstarch will need to be added to water to make a smooth slurry before adding to the pie mix. For either method, gently heat the pie mixture, till the starches thicken.