add simple ai and bug fix