Fix composition of density matrices and usage of orthoganilty.