corrected the logic that checks for region