various fixes in desparate attempt to get matrix tests going.
initial draft of matrix test.
more hacks attempting to debug what is going on with matrix.