fix serialization error when caching