GitHub #193: Improve handling of asynchronous events inside patches

Also: Fix bindings of "patch" and "self" in user patches; some work on error
handling