fix deadlock + race condition
fix deadlock + race condition

mtlynch/Sia,mtlynch/Sia,ChrisSchinnerl/Sia,mnsl/Sia,mharkus/Sia,ericflo/Sia,MrStrong/Sia,NebulousLabs/Sia,ericflo/Sia,ChrisSchinnerl/Sia,mharkus/Sia,NebulousLabs/Sia,rivine/rivine,MrStrong/Sia,rivine/rivine,mnsl/Sia