Can't index into temporary matrix