diff --git a/backend.php b/backend.php
index dec79f46fb4559ddd92bfb5826bb74070af22987..2ea39698767811a0212a31095ecd8691bc147443 100644
--- a/backend.php
+++ b/backend.php
@@ -46,7 +46,7 @@
 		UserHelper::authenticate( "admin", null);
 	}
 
-	if ($_SESSION["uid"]) {
+	if (!empty($_SESSION["uid"])) {
 		if (!validate_session()) {
 			header("Content-Type: text/json");
 			print error_json(6);
diff --git a/classes/handler/protected.php b/classes/handler/protected.php
index 765b17480e50777aa93c72e47c8f7fbce4bb29b1..8e9e5ca1dd75d446054a72996d756096bcba302b 100644
--- a/classes/handler/protected.php
+++ b/classes/handler/protected.php
@@ -2,6 +2,6 @@
 class Handler_Protected extends Handler {
 
 	function before($method) {
-		return parent::before($method) && $_SESSION['uid'];
+		return parent::before($method) && !empty($_SESSION['uid']);
 	}
 }