fix context on shared function