Fixed Query references in session handler