Fix database recovery