diff --git a/scripts/remove b/scripts/remove
index b0d36b7..e2c981a 100755
--- a/scripts/remove
+++ b/scripts/remove
@@ -45,6 +45,14 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2
 # Remove the dedicated PHP-FPM config
 ynh_remove_fpm_config
 
+#=================================================
+# REMOVE DEPENDENCIES
+#=================================================
+ynh_script_progression --message="Removing dependencies..." --weight=1
+
+# Remove metapackage and its dependencies if no other package need them
+ynh_remove_app_dependencies
+
 #=================================================
 # REMOVE FAIL2BAN CONFIGURATION
 #=================================================
diff --git a/scripts/restore b/scripts/restore
index 0f7e0c0..bfe1bca 100755
--- a/scripts/restore
+++ b/scripts/restore
@@ -45,12 +45,6 @@ test ! -d $final_path \
 
 #=================================================
 # STANDARD RESTORATION STEPS
-#=================================================
-# RESTORE THE NGINX CONFIGURATION
-#=================================================
-
-ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
-
 #=================================================
 # RECREATE THE DEDICATED USER
 #=================================================
@@ -121,6 +115,12 @@ ynh_script_progression --message="Restoring the Fail2Ban configuration..." --wei
 ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
 ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
 ynh_systemd_action --action=restart --service_name=fail2ban
+#=================================================
+# RESTORE THE NGINX CONFIGURATION
+#=================================================
+ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
+
+ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
 
 #=================================================
 # GENERIC FINALIZATION