Cleanups, catch KeyError explicitly if mapping_file is not defined