outer product bug fix and tests