better error handling in GetLangs func