improved context persistence