Added locale test
Fixed memory leak