diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 328fbd7a..6ba7a4f0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -62,6 +62,7 @@ if(OPENAL_SOUND)
         sound/oalsound/alsound.cpp
         sound/oalsound/buffer.cpp
         sound/oalsound/channel.cpp
+        sound/oalsound/check.cpp
     )
 endif()
 
diff --git a/src/app/app.cpp b/src/app/app.cpp
index d612c804..23813a00 100644
--- a/src/app/app.cpp
+++ b/src/app/app.cpp
@@ -61,8 +61,7 @@
 
 template<> CApplication* CSingleton<CApplication>::m_instance = nullptr;
 
-//! Static buffer for putenv locale
-static char S_LANGUAGE[50] = { 0 };
+char CApplication::m_languageLocale[] = { 0 };
 
 
 //! Interval of timer called to update joystick state
@@ -1699,8 +1698,8 @@ void CApplication::SetLanguage(Language language)
     {
         std::string langStr = "LANGUAGE=";
         langStr += locale;
-        strcpy(S_LANGUAGE, langStr.c_str());
-        putenv(S_LANGUAGE);
+        strcpy(m_languageLocale, langStr.c_str());
+        putenv(m_languageLocale);
         GetLogger()->Trace("SetLanguage: Set LANGUAGE=%s in environment\n", locale.c_str());
     }
 
diff --git a/src/app/app.h b/src/app/app.h
index ecb82378..443677ce 100644
--- a/src/app/app.h
+++ b/src/app/app.h
@@ -455,4 +455,7 @@ protected:
 
     //! Headles mode
     bool            m_headless;
+
+    //! Static buffer for putenv locale
+    static char m_languageLocale[50];
 };
diff --git a/src/app/input.cpp b/src/app/input.cpp
index fcfbe16a..e838a88a 100644
--- a/src/app/input.cpp
+++ b/src/app/input.cpp
@@ -36,12 +36,41 @@ template<> CInput* CSingleton<CInput>::m_instance = nullptr;
 
 CInput::CInput()
 {
+    m_keyTable =
+    {
+        { INPUT_SLOT_LEFT,     "left"    },
+        { INPUT_SLOT_RIGHT,    "right"   },
+        { INPUT_SLOT_UP,       "up"      },
+        { INPUT_SLOT_DOWN,     "down"    },
+        { INPUT_SLOT_GUP,      "gup"     },
+        { INPUT_SLOT_GDOWN,    "gdown"   },
+        { INPUT_SLOT_CAMERA,   "camera"  },
+        { INPUT_SLOT_DESEL,    "desel"   },
+        { INPUT_SLOT_ACTION,   "action"  },
+        { INPUT_SLOT_NEAR,     "near"    },
+        { INPUT_SLOT_AWAY,     "away"    },
+        { INPUT_SLOT_NEXT,     "next"    },
+        { INPUT_SLOT_HUMAN,    "human"   },
+        { INPUT_SLOT_QUIT,     "quit"    },
+        { INPUT_SLOT_HELP,     "help"    },
+        { INPUT_SLOT_PROG,     "prog"    },
+        { INPUT_SLOT_VISIT,    "visit"   },
+        { INPUT_SLOT_SPEED05,  "speed05" },
+        { INPUT_SLOT_SPEED10,  "speed10" },
+        { INPUT_SLOT_SPEED15,  "speed15" },
+        { INPUT_SLOT_SPEED20,  "speed20" },
+        { INPUT_SLOT_SPEED30,  "speed30" },
+        { INPUT_SLOT_SPEED40,  "speed40" },
+        { INPUT_SLOT_SPEED60,  "speed60" },
+        { INPUT_SLOT_CAMERA_UP,   "camup"   },
+        { INPUT_SLOT_CAMERA_DOWN, "camdown" },
+        { INPUT_SLOT_PAUSE,    "pause" },
+    };
+
     m_kmodState = 0;
     m_mousePos = Math::Point();
     m_mouseButtonsState = 0;
-
-    for(int i=0; i<INPUT_SLOT_MAX; i++)
-        m_keyPresses[i] = false;
+    std::fill_n(m_keyPresses, INPUT_SLOT_MAX, false);
 
     m_joystickDeadzone = 0.2f;
     SetDefaultInputBindings();
@@ -271,37 +300,6 @@ InputSlot CInput::FindBinding(unsigned int key)
     return INPUT_SLOT_MAX;
 }
 
-static std::map<InputSlot, std::string> keyTable =
-{
-    { INPUT_SLOT_LEFT,     "left"    },
-    { INPUT_SLOT_RIGHT,    "right"   },
-    { INPUT_SLOT_UP,       "up"      },
-    { INPUT_SLOT_DOWN,     "down"    },
-    { INPUT_SLOT_GUP,      "gup"     },
-    { INPUT_SLOT_GDOWN,    "gdown"   },
-    { INPUT_SLOT_CAMERA,   "camera"  },
-    { INPUT_SLOT_DESEL,    "desel"   },
-    { INPUT_SLOT_ACTION,   "action"  },
-    { INPUT_SLOT_NEAR,     "near"    },
-    { INPUT_SLOT_AWAY,     "away"    },
-    { INPUT_SLOT_NEXT,     "next"    },
-    { INPUT_SLOT_HUMAN,    "human"   },
-    { INPUT_SLOT_QUIT,     "quit"    },
-    { INPUT_SLOT_HELP,     "help"    },
-    { INPUT_SLOT_PROG,     "prog"    },
-    { INPUT_SLOT_VISIT,    "visit"   },
-    { INPUT_SLOT_SPEED05,  "speed05" },
-    { INPUT_SLOT_SPEED10,  "speed10" },
-    { INPUT_SLOT_SPEED15,  "speed15" },
-    { INPUT_SLOT_SPEED20,  "speed20" },
-    { INPUT_SLOT_SPEED30,  "speed30" },
-    { INPUT_SLOT_SPEED40,  "speed40" },
-    { INPUT_SLOT_SPEED60,  "speed60" },
-    { INPUT_SLOT_CAMERA_UP,   "camup"   },
-    { INPUT_SLOT_CAMERA_DOWN, "camdown" },
-    { INPUT_SLOT_PAUSE,    "pause" },
-};
-
 void CInput::SaveKeyBindings()
 {
     std::stringstream key;
@@ -313,7 +311,7 @@ void CInput::SaveKeyBindings()
         key.str("");
         key << b.primary << " " << b.secondary;
 
-        CConfigFile::GetInstancePointer()->SetStringProperty("Keybindings", keyTable[static_cast<InputSlot>(i)], key.str());
+        CConfigFile::GetInstancePointer()->SetStringProperty("Keybindings", m_keyTable[static_cast<InputSlot>(i)], key.str());
     }
 
     for (int i = 0; i < JOY_AXIS_SLOT_MAX; i++)
@@ -334,7 +332,7 @@ void CInput::LoadKeyBindings()
     {
         InputBinding b;
 
-        if (!CConfigFile::GetInstancePointer()->GetStringProperty("Keybindings", keyTable[static_cast<InputSlot>(i)], keys))
+        if (!CConfigFile::GetInstancePointer()->GetStringProperty("Keybindings", m_keyTable[static_cast<InputSlot>(i)], keys))
             continue;
         skey.clear();
         skey.str(keys);
@@ -365,7 +363,7 @@ void CInput::LoadKeyBindings()
 
 InputSlot CInput::SearchKeyById(std::string id)
 {
-    for(auto& key : keyTable)
+    for(auto& key : m_keyTable)
     {
         if ( id == key.second )
         {
diff --git a/src/app/input.h b/src/app/input.h
index 4b52f4e2..52d8c8c5 100644
--- a/src/app/input.h
+++ b/src/app/input.h
@@ -30,7 +30,7 @@
 
 #include "math/intpoint.h"
 
-
+#include <map>
 
 /**
  * \struct InputBinding
@@ -159,4 +159,6 @@ private:
     InputBinding    m_inputBindings[INPUT_SLOT_MAX];
     JoyAxisBinding  m_joyAxisBindings[JOY_AXIS_SLOT_MAX];
     float           m_joystickDeadzone;
+
+    std::map<InputSlot, std::string> m_keyTable;
 };
diff --git a/src/common/event.cpp b/src/common/event.cpp
index f694115f..b34cc958 100644
--- a/src/common/event.cpp
+++ b/src/common/event.cpp
@@ -26,15 +26,15 @@
 
 namespace
 {
-static EventType UNIQUE_EVENT_TYPE = EVENT_USER;
 const char* EVENT_TYPE_TEXT[EVENT_STD_MAX];
 }
 
 EventType GetUniqueEventType()
 {
-    int i = static_cast<int>(UNIQUE_EVENT_TYPE+1);
-    UNIQUE_EVENT_TYPE = static_cast<EventType>(i);
-    return UNIQUE_EVENT_TYPE;
+    static EventType uniqueEventType = EVENT_USER;
+    int nextUniqueEventType = static_cast<int>(uniqueEventType+1);
+    uniqueEventType = static_cast<EventType>(nextUniqueEventType);
+    return uniqueEventType;
 }
 
 void InitializeEventTypeTexts()
diff --git a/src/common/restext.cpp b/src/common/restext.cpp
index 9193d872..c7a41f6f 100644
--- a/src/common/restext.cpp
+++ b/src/common/restext.cpp
@@ -761,8 +761,10 @@ void InitializeRestext()
 }
 
 
-
-static char         g_gamerName[100];
+namespace
+{
+char g_gamerName[100];
+} // anonymous namespace
 
 void SetGlobalGamerName(std::string name)
 {
@@ -771,7 +773,10 @@ void SetGlobalGamerName(std::string name)
 
 // Replaces the commands "\key name;" in a text.
 
-static void PutKeyName(std::string& dst, const char* src)
+namespace
+{
+
+void PutKeyName(std::string& dst, const char* src)
 {
     dst.clear();
 
@@ -801,7 +806,7 @@ static void PutKeyName(std::string& dst, const char* src)
 
 // Returns the translated text of a resource that needs key substitution
 
-static const char* GetResourceBase(ResType type, unsigned int num)
+const char* GetResourceBase(ResType type, unsigned int num)
 {
     const char *str = NULL;
 
@@ -846,6 +851,8 @@ static const char* GetResourceBase(ResType type, unsigned int num)
     return gettext(str);
 }
 
+} // anonymous namespace
+
 // Returns the text of a resource.
 
 bool GetResource(ResType type, unsigned int num, std::string& text)
diff --git a/src/common/stringutils.cpp b/src/common/stringutils.cpp
index 9edc82d6..21f3826b 100644
--- a/src/common/stringutils.cpp
+++ b/src/common/stringutils.cpp
@@ -25,7 +25,10 @@
 #include <vector>
 
 
-static std::string VFormat(const char *fmt, va_list ap)
+namespace
+{
+
+std::string VFormat(const char *fmt, va_list ap)
 {
     size_t size = 1024;
     char stackbuf[1024];
@@ -47,6 +50,8 @@ static std::string VFormat(const char *fmt, va_list ap)
     }
 }
 
+} // anonymous namespace
+
 std::string StrUtils::Format(const char *fmt, ...)
 {
     va_list ap;
diff --git a/src/sound/oalsound/buffer.cpp b/src/sound/oalsound/buffer.cpp
index c6075cb8..eae59839 100644
--- a/src/sound/oalsound/buffer.cpp
+++ b/src/sound/oalsound/buffer.cpp
@@ -40,8 +40,8 @@ Buffer::~Buffer()
     if (m_loaded)
     {
         alDeleteBuffers(1, &m_buffer);
-        if (alCheck())
-            GetLogger()->Debug("Failed to unload buffer. Code %d\n", alGetCode());
+        if (CheckOpenALError())
+            GetLogger()->Debug("Failed to unload buffer. Code %d\n", GetOpenALErrorCode());
     }
 }
 
diff --git a/src/sound/oalsound/channel.cpp b/src/sound/oalsound/channel.cpp
index a68e0f0c..810eedeb 100644
--- a/src/sound/oalsound/channel.cpp
+++ b/src/sound/oalsound/channel.cpp
@@ -35,9 +35,9 @@ Channel::Channel()
 {
     alGenSources(1, &m_source);
 
-    if (alCheck())
+    if (CheckOpenALError())
     {
-        GetLogger()->Debug("Failed to create sound source. Code: %d\n", alGetCode());
+        GetLogger()->Debug("Failed to create sound source. Code: %d\n", GetOpenALErrorCode());
         m_ready = false;
     }
     else
@@ -54,8 +54,8 @@ Channel::~Channel()
         alSourceStop(m_source);
         alSourcei(m_source, AL_BUFFER, 0);
         alDeleteSources(1, &m_source);
-        if (alCheck())
-            GetLogger()->Debug("Failed to delete sound source. Code: %d\n", alGetCode());
+        if (CheckOpenALError())
+            GetLogger()->Debug("Failed to delete sound source. Code: %d\n", GetOpenALErrorCode());
     }
 }
 
@@ -71,9 +71,9 @@ bool Channel::Play()
     alSourcei(m_source, AL_REFERENCE_DISTANCE, 10.0f);
     alSourcei(m_source, AL_MAX_DISTANCE, 110.0f);
     alSourcePlay(m_source);
-    if (alCheck())
+    if (CheckOpenALError())
     {
-        GetLogger()->Debug("Could not play audio sound source. Code: %d\n", alGetCode());
+        GetLogger()->Debug("Could not play audio sound source. Code: %d\n", GetOpenALErrorCode());
     }
     return true;
 }
@@ -86,9 +86,9 @@ bool Channel::Pause()
     }
 
     alSourcePause(m_source);
-    if (alCheck())
+    if (CheckOpenALError())
     {
-        GetLogger()->Debug("Could not pause audio sound source. Code: %d\n", alGetCode());
+        GetLogger()->Debug("Could not pause audio sound source. Code: %d\n", GetOpenALErrorCode());
     }
     return true;
 }
@@ -102,9 +102,9 @@ bool Channel::SetPosition(const Math::Vector &pos)
     }
 
     alSource3f(m_source, AL_POSITION, pos.x, pos.y, pos.z);
-    if (alCheck())
+    if (CheckOpenALError())
     {
-        GetLogger()->Debug("Could not set sound position. Code: %d\n", alGetCode());
+        GetLogger()->Debug("Could not set sound position. Code: %d\n", GetOpenALErrorCode());
         return false;
     }
     return true;
@@ -119,9 +119,9 @@ bool Channel::SetFrequency(float freq)
     }
 
     alSourcef(m_source, AL_PITCH, freq);
-    if (alCheck())
+    if (CheckOpenALError())
     {
-        GetLogger()->Debug("Could not set sound pitch to '%f'. Code: %d\n", freq, alGetCode());
+        GetLogger()->Debug("Could not set sound pitch to '%f'. Code: %d\n", freq, GetOpenALErrorCode());
         return false;
     }
     return true;
@@ -137,9 +137,9 @@ float Channel::GetFrequency()
     }
 
     alGetSourcef(m_source, AL_PITCH, &freq);
-    if (alCheck())
+    if (CheckOpenALError())
     {
-        GetLogger()->Debug("Could not get sound pitch. Code: %d\n", alGetCode());
+        GetLogger()->Debug("Could not get sound pitch. Code: %d\n", GetOpenALErrorCode());
         return 0;
     }
 
@@ -155,9 +155,9 @@ bool Channel::SetVolume(float vol)
     }
 
     alSourcef(m_source, AL_GAIN, vol);
-    if (alCheck())
+    if (CheckOpenALError())
     {
-        GetLogger()->Debug("Could not set sound volume to '%f'. Code: %d\n", vol, alGetCode());
+        GetLogger()->Debug("Could not set sound volume to '%f'. Code: %d\n", vol, GetOpenALErrorCode());
         return false;
     }
     return true;
@@ -173,9 +173,9 @@ float Channel::GetVolume()
     }
 
     alGetSourcef(m_source, AL_GAIN, &vol);
-    if (alCheck())
+    if (CheckOpenALError())
     {
-        GetLogger()->Debug("Could not get sound volume. Code: %d\n", alGetCode());
+        GetLogger()->Debug("Could not get sound volume. Code: %d\n", GetOpenALErrorCode());
         return 0;
     }
 
@@ -287,9 +287,9 @@ bool Channel::SetBuffer(Buffer *buffer)
     }
 
     alSourcei(m_source, AL_BUFFER, buffer->GetBuffer());
-    if (alCheck())
+    if (CheckOpenALError())
     {
-        GetLogger()->Warn("Could not set sound buffer. Code: %d\n", alGetCode());
+        GetLogger()->Warn("Could not set sound buffer. Code: %d\n", GetOpenALErrorCode());
         return false;
     }
     m_initFrequency = GetFrequency();
@@ -305,9 +305,9 @@ bool Channel::IsPlaying()
     }
 
     alGetSourcei(m_source, AL_SOURCE_STATE, &status);
-    if (alCheck())
+    if (CheckOpenALError())
     {
-        GetLogger()->Warn("Could not get sound status. Code: %d\n", alGetCode());
+        GetLogger()->Warn("Could not get sound status. Code: %d\n", GetOpenALErrorCode());
         return false;
     }
 
@@ -334,9 +334,9 @@ bool Channel::Stop()
     }
 
     alSourceStop(m_source);
-    if (alCheck())
+    if (CheckOpenALError())
     {
-        GetLogger()->Warn("Could not stop sound. Code: %d\n", alGetCode());
+        GetLogger()->Warn("Could not stop sound. Code: %d\n", GetOpenALErrorCode());
         return false;
     }
     return true;
@@ -352,9 +352,9 @@ float Channel::GetCurrentTime()
 
     ALfloat current;
     alGetSourcef(m_source, AL_SEC_OFFSET, &current);
-    if (alCheck())
+    if (CheckOpenALError())
     {
-        GetLogger()->Warn("Could not get source current play time. Code: %d\n", alGetCode());
+        GetLogger()->Warn("Could not get source current play time. Code: %d\n", GetOpenALErrorCode());
         return 0.0f;
     }
     return current;
@@ -369,9 +369,9 @@ void Channel::SetCurrentTime(float current)
     }
 
     alSourcef(m_source, AL_SEC_OFFSET, current);
-    if (alCheck())
+    if (CheckOpenALError())
     {
-        GetLogger()->Warn("Could not get source current play time. Code: %d\n", alGetCode());
+        GetLogger()->Warn("Could not get source current play time. Code: %d\n", GetOpenALErrorCode());
     }
 }
 
diff --git a/src/sound/oalsound/check.cpp b/src/sound/oalsound/check.cpp
new file mode 100644
index 00000000..b208b5f0
--- /dev/null
+++ b/src/sound/oalsound/check.cpp
@@ -0,0 +1,19 @@
+#include "sound/oalsound/check.h"
+
+namespace
+{
+ALenum g_errorCode = AL_NO_ERROR;
+} // anonymous namespace
+
+bool CheckOpenALError()
+{
+    g_errorCode = alGetError();
+    return g_errorCode != AL_NO_ERROR;
+}
+
+ALenum GetOpenALErrorCode()
+{
+    ALenum ret = g_errorCode;
+    g_errorCode = AL_NO_ERROR;
+    return ret;
+}
diff --git a/src/sound/oalsound/check.h b/src/sound/oalsound/check.h
index ec0a3288..949712ed 100644
--- a/src/sound/oalsound/check.h
+++ b/src/sound/oalsound/check.h
@@ -24,20 +24,6 @@
 #include "common/logger.h"
 
 #include <al.h>
-#include <alc.h>
-
-static ALenum CODE = AL_NO_ERROR;
-
-inline bool alCheck()
-{
-    CODE = alGetError();
-    return CODE != AL_NO_ERROR;
-}
-
-inline ALenum alGetCode()
-{
-    ALenum ret = CODE;
-    CODE = AL_NO_ERROR;
-    return ret;
-}
 
+bool CheckOpenALError();
+ALenum GetOpenALErrorCode();
diff --git a/src/ui/screen/screen_apperance.cpp b/src/ui/screen/screen_apperance.cpp
index b497e2b4..b35ec262 100644
--- a/src/ui/screen/screen_apperance.cpp
+++ b/src/ui/screen/screen_apperance.cpp
@@ -36,7 +36,7 @@
 namespace Ui
 {
 
-static int PERSO_COLOR[3*10*3] =
+const int PERSO_COLOR[3*10*3] =
 {
     // hair:
     193, 221, 226,  // white