enhancing AI and a few bug fixes