fileProvider: more changes to the file copying code, still no success in making it always work well.