Add fault tolerance

I actually meant to merge this into our own fork first.

@fosdev @mszenher