fix dead lock