Add tests for serialization and fix pre-load serialization issue in CachedRegistry