Fix AttributeError when explicitly specifying wait type, and add appropriate regression tests. (fixes #4)