bug fix, possible dead lock in multi-threading fixed.