Improved locale checking