Fixing crash bug with skeleton AI