Add code to recover on crash
Merge branch 'recover-last-failed-write'

* recover-last-failed-write:
  Add code to recover on crash