Fix undefined variable e

I'm also adding the capability to do setLocale(i18n.preferredLocale()) even when i18n.preferredLocale() returns null.