Fix production mode bug and add locale determination