Fixed bugs with AI client creation