Small optimizations
Fixed locale issue