fix for non-english locale systems

code clean up
thanks noah