added missing 'handleLostContext' check