fixed shared state bug