Fix store handling of _encode and _decode and fix of storage events