diff --git a/db/db.update.146.user.inc.php b/db/db.update.146.user.inc.php
index 84c557ba..51be3616 100644
--- a/db/db.update.146.user.inc.php
+++ b/db/db.update.146.user.inc.php
@@ -257,7 +257,7 @@ function db146_user_load_by_email($email)
 {
 	/* Find the most recent uid for the email, regardless of deleted status */
 	$e = mysql_real_escape_string($email);
-	$q = mysql_query("SELECT uid FROM users WHERE email='$e' ORDER BY year DESC LIMIT 1");
+	$q = mysql_query("SELECT uid FROM users WHERE email='$e' OR username='$e' ORDER BY year DESC LIMIT 1");
 
 	if(mysql_num_rows($q) == 1) {
 			$i = mysql_fetch_assoc($q);
@@ -707,6 +707,9 @@ function db146_user_create($type, $username, $u = NULL)
 			VALUES ('$type','$username','0000-00-00', NOW(), '{$config['FAIRYEAR']}')");
 		echo mysql_error();
 		$uid = mysql_insert_id();
+        if(db146_user_valid_email($username)) {
+            mysql_query("UPDATE users SET email='$username' WHERE id='$uid'");
+        }
 		mysql_query("UPDATE users SET uid='$uid' WHERE id='$uid'");
 		echo mysql_error();
 		db146_user_set_password($uid, NULL);
diff --git a/db/db.update.149.php b/db/db.update.149.php
new file mode 100644
index 00000000..02b99d96
--- /dev/null
+++ b/db/db.update.149.php
@@ -0,0 +1,48 @@
+<?
+//146 user inc works fine here
+include "db.update.146.inc.php";
+
+function db_update_142_post() {
+	$q=mysql_query("SELECT * FROM emergencycontact");
+	while($r=mysql_fetch_object($q))  {
+		$relation=strtolower(trim($r->relation));
+		if(			levenshtein('parent',$relation)<2 
+				|| levenshtein('mother',$relation)<3 
+				|| levenshtein('father',$relation)<3 
+				|| levenshtein('mom',$relation)<2 
+				|| levenshtein('mere',$relation)<2 
+				|| levenshtein('dad',$relation)<2
+				|| levenshtein('pere',$relation)<2
+				|| strstr($relation,'dad') 
+				|| strstr($relation,'mom') 
+				|| (strstr($relation,"mother") && !strstr($relation,"grand"))
+				|| (strstr($relation,"father") && !strstr($relation,"grand"))
+		)  
+		{ 
+			echo "YES: $r->firstname $r->lastname with relation '$r->relation' looks like a parent\n";
+			if($r->email) {
+				echo "  Have email, creating record - $r->email\n";
+				if($u=db146_user_load_by_email($r->email)) {
+				echo "This user already exists, linking parent record to their account!";
+				db146_user_create("parent",$r->email,$u);
+				}
+				else {
+					echo "Creating new parent record\n";
+					$u=db146_user_create("parent",$r->email);
+					$u['firstname']=$r->firstname;
+					$u['lastname']=$r->lastname;
+					$u['phonehome']=$r->phone1;
+					$u['phonework']=$r->phone2;
+					db146_user_save($u);
+				}
+			}
+			else {
+				echo "No email address, skipping";
+			}
+		}   
+		else {
+			echo "NO:  $r->firstname $r->lastname with relation '$r->relation' is NOT a parent\n";
+		}
+	}
+}
+?>
diff --git a/db/db.update.149.sql b/db/db.update.149.sql
new file mode 100644
index 00000000..e69de29b