Made session more robust