Fix for issue #69 (NPEs when serializing cache)