fixed some stupid race conditions in subprocess