added automatic refresh when nonce expired, useful when restoring browser session after a long period of time