fix dead lock problem.