fixed bug in mmm with ai[j] missing