Fixed unusual behaviour of session variables