upgrade.php improvement