Made session caching more reliable and accurate