diff --git a/bindings/java/src/org/sleuthkit/datamodel/WindowsAccountUtils.java b/bindings/java/src/org/sleuthkit/datamodel/WindowsAccountUtils.java
index 160b6d7551eeeb910560aa870c591374778b8187..0f1a9d37e8824b86426c4afb6377a0ba695e010b 100644
--- a/bindings/java/src/org/sleuthkit/datamodel/WindowsAccountUtils.java
+++ b/bindings/java/src/org/sleuthkit/datamodel/WindowsAccountUtils.java
@@ -134,7 +134,7 @@ static boolean isWindowsSpecialSid(String sid) {
 			return true;
 		}
 		for (String specialPrefix: SPECIAL_SID_PREFIXES) {
-			if (sid.startsWith(specialPrefix)) {
+			if (tempSID.startsWith(specialPrefix)) {
 				return true;
 			}
 		}
@@ -197,7 +197,7 @@ public static String getWindowsRealmAddress(String sid) throws TskCoreException
 		String tempSID = stripWindowsBackupPostfix(sid);
 		
 		// When copying realms into portable cases, the SID may already be set to the special windows string.
-		if (isWindowsSpecialSid(tempSID) || sid.equals(SPECIAL_WINDOWS_REALM_ADDR)) {
+		if (isWindowsSpecialSid(tempSID) || tempSID.equals(SPECIAL_WINDOWS_REALM_ADDR)) {
 			realmAddr = SPECIAL_WINDOWS_REALM_ADDR;
 		} else {
 			// regular SIDs should have at least 5 components: S-1-x-y-z