fixed a possible infinite loop bug in handling error when no locale data is found