Fix for infinite waits

* fixed the protocol (although the proof still need to be updated)
* fixed the API