diff --git a/lib/session.php b/lib/session.php
index 55758432f0e8807012724d58d72ff6b8e22cdf34..08f2a14f2113b915946fccaa4c245e1f84789c72 100644
--- a/lib/session.php
+++ b/lib/session.php
@@ -41,7 +41,9 @@ private $datahash='';		// hash of data field
 		$token = $this->genSessionID(); 
 		$DB->Execute("insert into {$this->table} (hash, lastseen, ip) values (?,NOW(),?)", array($token, $_SERVER['REMOTE_ADDR']));
 		setcookie("sucssite_session", $token, NULL, "/", $preferred_hostname);
-		setcookie("sucssite_loggedin", "false", time());
+	
+		// delete loggedin cookie if it exists
+		setcookie("sucssite_loggedin", FALSE, time(), "/");
 		$this->token = $token;
 		return;
 	}
@@ -192,7 +194,7 @@ private $datahash='';		// hash of data field
 		$DB->Execute("delete from {$this->table} where hash=?", array($this->token));
 		$this->newsession();
 		$this->loggedin = FALSE;
-		setcookie("sucssite_loggedin", "false");
+		setcookie("sucssite_loggedin", FALSE, time(), "/");
 	}
 
 	// Fill out any extra details we know about the user