fixed a deadlock and seems to be stable now