Adding check to see if the session is not corrupted