fix a bug in the way we poll for completion of invocations (#17)
For documenation on the client, consult here.