Fixed bug when redirect occurs when locale is undefined.