changed db error function