Fix locale override and restore.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>