Add special session handling for selectedResource

Add special session handling for selectedResource to avoid leaks through session