added code to remove unreferenced map surrogates