modify code to not changing global locale