DeleteEmptyReferences at the end