fix error when region is undefined