fixed minor bugs in driver/ai.

TODO properly handle thread interrupt