Save valid_attributes in cache_fields (fixes crash after enabling a field)