diff --git a/core/database.class.php b/core/database.class.php
index 1571abc8..71cd2110 100644
--- a/core/database.class.php
+++ b/core/database.class.php
@@ -70,9 +70,9 @@ class MySQL extends DBEngine {
 	public function create_table_sql($name, $data) {
 		$data = str_replace("SCORE_AIPK", "INTEGER PRIMARY KEY auto_increment", $data);
 		$data = str_replace("SCORE_INET", "CHAR(15)", $data);
-		$data = str_replace("SCORE_BOOL", "ENUM('Y', 'N')", $data);
 		$data = str_replace("SCORE_BOOL_Y", "'Y'", $data);
 		$data = str_replace("SCORE_BOOL_N", "'N'", $data);
+		$data = str_replace("SCORE_BOOL", "ENUM('Y', 'N')", $data);
 		$data = str_replace("SCORE_NOW", "\"1970-01-01\"", $data);
 		$ctes = "TYPE=InnoDB DEFAULT CHARSET='utf8'";
 		return "CREATE TABLE $name ($data) $ctes";
@@ -87,9 +87,9 @@ class PostgreSQL extends DBEngine {
 	public function create_table_sql($name, $data) {
 		$data = str_replace("SCORE_AIPK", "SERIAL PRIMARY KEY", $data);
 		$data = str_replace("SCORE_INET", "INET", $data);
-		$data = str_replace("SCORE_BOOL", "BOOL", $data);
 		$data = str_replace("SCORE_BOOL_Y", "'t'", $data);
 		$data = str_replace("SCORE_BOOL_N", "'f'", $data);
+		$data = str_replace("SCORE_BOOL", "BOOL", $data);
 		$data = str_replace("SCORE_NOW", "current_time", $data);
 		return "CREATE TABLE $name ($data)";
 	}
diff --git a/install.php b/install.php
index 6b639acf..b02d30ff 100644
--- a/install.php
+++ b/install.php
@@ -187,7 +187,7 @@ function create_tables($dsn) { // {{{
 		$db->execute($engine->create_table_sql("tags", "
 			id SCORE_AIPK,
 			tag VARCHAR(64) NOT NULL,
-			count NOT NULL DEFAULT 0,
+			count INTEGER NOT NULL DEFAULT 0,
 			INDEX(tag)
 		"));
 		$db->execute($engine->create_table_sql("image_tags", "