Compare unserialized value when assigning serialized attributes to changed_attributes

This is my attempt at a fix for #12505