Improved language code handling