Fixed: small bug when saving references.