#1973 Fixed race condition in startServer

Closes #1973