diff --git a/controller.go b/controller.go
index <HASH>..<HASH> 100644
--- a/controller.go
+++ b/controller.go
@@ -1,12 +1,19 @@
 package action_bar
 
 import (
-	"github.com/qor/admin"
 	"net/http"
+
+	"github.com/qor/admin"
 )
 
 func SwitchMode(context *admin.Context) {
 	cookie := http.Cookie{Name: "qor-action-bar", Value: context.Request.URL.Query().Get("checked"), Path: "/", HttpOnly: true}
 	http.SetCookie(context.Writer, &cookie)
-	http.Redirect(context.Writer, context.Request, "/", http.StatusFound)
+
+	referrer := context.Request.Referer()
+	if referrer == "" {
+		referrer = "/"
+	}
+
+	http.Redirect(context.Writer, context.Request, referrer, http.StatusFound)
 }
Redirect back to referrer url