Improvement to code handling locale.