fix db.php function