Rework metadata mapping to fix breakage under OS X