fix locale valid check