minor improvements to source_flattener to facilitate usage in erfa