Fix issues on building match structure.