Fixes for the "ai" implementation