adapted state matrix to have the states in the correct order for the matrix elements