Fixed issue 19 by handling unexpected Object.wait() wakeups

As suggested by @mpoindexter, I've made this fix proposal for #19. I've made the assumption that Task objects are only used once and then thrown away, hope I haven't missed the mark completely. Anyway, with this fix in place, I was unable to reproduce the issue.