more generalized attempt to fix race conditions
Merge pull request #18 from dimagi/cz

more generalized attempt to fix race conditions