Fix bug in offline template.
Fix an important bug when reading the region files.