fixed various bugs with metadata mapping and email notification
bug fixes in metadata mapping