working with AI - loads of bugfixes