1. ndims in tupletype modified .
2. bug in matrix type removed.