Fixed the check for matrix inequality

!= does not work correctly with matrices. Using ‘identical’ instead.
Also added a message to inform the user that the state has been
preserved.