fix flatten_and_store method to store change with proper seq_id