added a guard and a message after an db error to prevent timeouts