diff --git a/sm5/VERSION b/sm5/VERSION
index 98d9bcb75a685dfbfd60f611c309410152935b3d..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 100644
--- a/sm5/VERSION
+++ b/sm5/VERSION
@@ -1 +1 @@
-17
+18
diff --git a/sm5/ataprint.c b/sm5/ataprint.c
index e2e471fce20a212b535b363bcd3e59c8b75ab011..44407a06d986df737a2a010e2e45036a4828d7a0 100644
--- a/sm5/ataprint.c
+++ b/sm5/ataprint.c
@@ -29,7 +29,7 @@
 #include "smartctl.h"
 #include "extern.h"
 
-const char *CVSid2="$Id: ataprint.c,v 1.35 2002/10/28 23:46:59 ballen4705 Exp $"
+const char *CVSid2="$Id: ataprint.c,v 1.36 2002/10/29 10:06:20 ballen4705 Exp $"
 CVSID1 CVSID2 CVSID3 CVSID6;
 
 // for passing global control variables
@@ -376,8 +376,8 @@ void PrintSmartAttribWithThres (struct ata_smart_values data,
       int failednow,failedever;
       char attributename[64];
 
-      failednow =disk->current <= thre->threshold;
-      failedever=disk->worst   <= thre->threshold;
+      failednow = (disk->current <= thre->threshold);
+      failedever= (disk->worst   <= thre->threshold);
       
       // These break out of the loop if we are only printing certain entries...
       if (onlyfailed==1 && (!disk->status.flag.prefailure || !failednow))
@@ -650,11 +650,23 @@ int ataPrintSmartSelfTestlog(struct ata_smart_selftestlog data,int allentries){
       case 15:msgstat="Test in progress             "; break;
       default:msgstat="Unknown test status          ";
       }
-      
-      retval+=errorfound;
 
+      retval+=errorfound;
       sprintf(percent,"%1d0%%",(log->selfteststatus)&0xf);
-      if (log->lbafirstfailure==0xffffffff || log->lbafirstfailure==0x00000000)
+
+      // T13/1321D revision 1c: (Data structure Rev #1)
+
+      //The failing LBA shall be the LBA of the uncorrectable sector
+      //that caused the test to fail. If the device encountered more
+      //than one uncorrectable sector during the test, this field
+      //shall indicate the LBA of the first uncorrectable sector
+      //encountered. If the test passed or the test failed for some
+      //reason other than an uncorrectable sector, the value of this
+      //field is undefined.
+
+      // This is true in ALL ATA-5 specs
+      
+      if (!errorfound || log->lbafirstfailure==0xffffffff || log->lbafirstfailure==0x00000000)
 	sprintf(firstlba,"%s","");
       else	
 	sprintf(firstlba,"0x%08x",log->lbafirstfailure);
diff --git a/sm5/ataprint.cpp b/sm5/ataprint.cpp
index 2e332784ca2fada4e72c7abe31e6f7a58f893d83..15cde024f29be90e467e973d38edbf5e8f73c73d 100644
--- a/sm5/ataprint.cpp
+++ b/sm5/ataprint.cpp
@@ -29,7 +29,7 @@
 #include "smartctl.h"
 #include "extern.h"
 
-const char *CVSid2="$Id: ataprint.cpp,v 1.35 2002/10/28 23:46:59 ballen4705 Exp $"
+const char *CVSid2="$Id: ataprint.cpp,v 1.36 2002/10/29 10:06:20 ballen4705 Exp $"
 CVSID1 CVSID2 CVSID3 CVSID6;
 
 // for passing global control variables
@@ -376,8 +376,8 @@ void PrintSmartAttribWithThres (struct ata_smart_values data,
       int failednow,failedever;
       char attributename[64];
 
-      failednow =disk->current <= thre->threshold;
-      failedever=disk->worst   <= thre->threshold;
+      failednow = (disk->current <= thre->threshold);
+      failedever= (disk->worst   <= thre->threshold);
       
       // These break out of the loop if we are only printing certain entries...
       if (onlyfailed==1 && (!disk->status.flag.prefailure || !failednow))
@@ -650,11 +650,23 @@ int ataPrintSmartSelfTestlog(struct ata_smart_selftestlog data,int allentries){
       case 15:msgstat="Test in progress             "; break;
       default:msgstat="Unknown test status          ";
       }
-      
-      retval+=errorfound;
 
+      retval+=errorfound;
       sprintf(percent,"%1d0%%",(log->selfteststatus)&0xf);
-      if (log->lbafirstfailure==0xffffffff || log->lbafirstfailure==0x00000000)
+
+      // T13/1321D revision 1c: (Data structure Rev #1)
+
+      //The failing LBA shall be the LBA of the uncorrectable sector
+      //that caused the test to fail. If the device encountered more
+      //than one uncorrectable sector during the test, this field
+      //shall indicate the LBA of the first uncorrectable sector
+      //encountered. If the test passed or the test failed for some
+      //reason other than an uncorrectable sector, the value of this
+      //field is undefined.
+
+      // This is true in ALL ATA-5 specs
+      
+      if (!errorfound || log->lbafirstfailure==0xffffffff || log->lbafirstfailure==0x00000000)
 	sprintf(firstlba,"%s","");
       else	
 	sprintf(firstlba,"0x%08x",log->lbafirstfailure);
diff --git a/sm5/smartd.c b/sm5/smartd.c
index dfdad3c6397105c6e8b8ca68569c19e159c00f7a..0e42d282e5607782c81b22089a26e1f08f0811a0 100644
--- a/sm5/smartd.c
+++ b/sm5/smartd.c
@@ -43,7 +43,7 @@
 
 // CVS ID strings
 extern const char *CVSid1, *CVSid2;
-const char *CVSid6="$Id: smartd.c,v 1.38 2002/10/29 00:02:43 ballen4705 Exp $" 
+const char *CVSid6="$Id: smartd.c,v 1.39 2002/10/29 10:06:20 ballen4705 Exp $" 
 CVSID1 CVSID2 CVSID3 CVSID4 CVSID7;
 
 // global variable used for control of printing, passing arguments, etc.
@@ -516,7 +516,7 @@ int ataCheckDevice(atadevices_t *drive){
 	    while (*loc && *loc==' ') loc++;
 	    
 	    // warning message
-	    printout(LOG_CRIT,"Device: %s, Failed SMART usage attribute: %s. Use smartctl -v %s.\n", name, loc, name);
+	    printout(LOG_CRIT,"Device: %s, Failed SMART usage attribute: %s.\n", name, loc, name);
 	  }
 	}
 	
@@ -1098,7 +1098,7 @@ int main (int argc, char **argv){
   
   // if there was no config file, create needed entries
   if (!entries){
-    printout(LOG_INFO,"smartctl: file %s not found. Searching for devices.\n",CONFIGFILE);
+    printout(LOG_INFO,"smartd: file %s not found. Searching for devices.\n",CONFIGFILE);
     entries+=makeconfigentries(MAXATADEVICES,"/dev/hda",1,entries);
     entries+=makeconfigentries(MAXSCSIDEVICES,"/dev/sda",0,entries);
   }
diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp
index 6269b613f1216918dffb3e80db9353cd3ec5425d..f0e6fe996490971e85ffb1bd2b7b68aa327cbba6 100644
--- a/sm5/smartd.cpp
+++ b/sm5/smartd.cpp
@@ -43,7 +43,7 @@
 
 // CVS ID strings
 extern const char *CVSid1, *CVSid2;
-const char *CVSid6="$Id: smartd.cpp,v 1.38 2002/10/29 00:02:43 ballen4705 Exp $" 
+const char *CVSid6="$Id: smartd.cpp,v 1.39 2002/10/29 10:06:20 ballen4705 Exp $" 
 CVSID1 CVSID2 CVSID3 CVSID4 CVSID7;
 
 // global variable used for control of printing, passing arguments, etc.
@@ -516,7 +516,7 @@ int ataCheckDevice(atadevices_t *drive){
 	    while (*loc && *loc==' ') loc++;
 	    
 	    // warning message
-	    printout(LOG_CRIT,"Device: %s, Failed SMART usage attribute: %s. Use smartctl -v %s.\n", name, loc, name);
+	    printout(LOG_CRIT,"Device: %s, Failed SMART usage attribute: %s.\n", name, loc, name);
 	  }
 	}
 	
@@ -1098,7 +1098,7 @@ int main (int argc, char **argv){
   
   // if there was no config file, create needed entries
   if (!entries){
-    printout(LOG_INFO,"smartctl: file %s not found. Searching for devices.\n",CONFIGFILE);
+    printout(LOG_INFO,"smartd: file %s not found. Searching for devices.\n",CONFIGFILE);
     entries+=makeconfigentries(MAXATADEVICES,"/dev/hda",1,entries);
     entries+=makeconfigentries(MAXSCSIDEVICES,"/dev/sda",0,entries);
   }