Fix race condition while restarting (fixes #560)
Merge pull request #562 from AudriusButkevicius/restart

Fix race condition while restarting (fixes #560)