Fixed a bug in the locales function that would cause trouble.