getting rid of stringbuffer and fixing locale issue