Fix multiple instances bug

closes #28
- added stopdone to wait for server to stop
- renamed done to startdone
- added testsequence which is able to reproduce the bug without my
changes
Merge pull request #29 from sebgie/issue#28

Fix multiple instances bug