updated and removed try/catch blocks, they were already in db.php, added loop for deadlock