Added 500 error code on db error