fixed a bug with setlocale()