Fix incorrect locale pref reading

Clone and closes #42. @PinZhang, in the future please push these pull request branches to this shared repository directly and make a pull request that I can edit/rebase.