fixing timing issues which cause many node process to spawn