Fixed issue: session write check is unreliable