update session when switching between buffers