Bug fix in aai.rb