Fix for bug #638

Funny no one hit this bug in ... a very long time.
Merge pull request #639 from linas/wsd-fail

Fix for bug #638