Multiple fixes

This will break if the file fields_to_be_renamed is deleted. Instead, put the rename map in a separate file and import that file in both these patches so as to avoid problems with inadvertent deletion.