fixes bug where session context was not reset correctly after failed request