Backport EDAlias anf failed edm::Ref fix to 6_2_X

Nicola Pozzobon reported a problem with edm::Refs which was ultimately traced back to a bug in the handling of EDAlias. See https://hypernews.cern.ch/HyperNews/CMS/get/edmFramework/3159/1/1/1/1/1/1/1.html. This fix was successfully integrated into CMSSW_7_0_X but needs to be backported to CMSSW_6_2_X since it affects any production job which uses an EDAlias.