Fixed crash on concurrent thread calls to setlocale
Fixed crashes with NULL strings in C++11 impl