bugfixes in cache serialization
demo script corrected