Fix some bugs in predb.php