diff --git a/avr.c b/avr.c
index df2b527d..8d28cbb8 100644
--- a/avr.c
+++ b/avr.c
@@ -823,6 +823,7 @@ int avr_chip_erase(int fd, AVRPART * p)
   unsigned char cmd[4];
   unsigned char res[4];
   int cycles;
+  int rc;
 
   if (p->op[AVR_OP_CHIP_ERASE] == NULL) {
     fprintf(stderr, "chip erase instruction not defined for part \"%s\"\n",
@@ -830,13 +831,13 @@ int avr_chip_erase(int fd, AVRPART * p)
     return -1;
   }
 
-  cycles = avr_get_cycle_count(fd, p);
+  rc = avr_get_cycle_count(fd, p, &cycles);
 
   /*
    * only print out the current cycle count if we aren't going to
    * display it below 
    */
-  if (!do_cycles && ((cycles != -1) && (cycles != 0x00ffff))) {
+  if (!do_cycles && ((rc >= 0) && (cycles != 0xffffffff))) {
     fprintf(stderr,
             "%s: current erase-rewrite cycle count is %d%s\n",
             progname, cycles, 
@@ -1042,7 +1043,7 @@ int avr_verify(AVRPART * p, AVRPART * v, char * memtype, int size)
 }
 
 
-int avr_get_cycle_count(int fd, AVRPART * p)
+int avr_get_cycle_count(int fd, AVRPART * p, int * cycles)
 {
   AVRMEM * a;
   int cycle_count;
@@ -1092,7 +1093,9 @@ int avr_get_cycle_count(int fd, AVRPART * p)
     (((unsigned int)v3) << 8) |
     v4;
 
-  return cycle_count;
+  *cycles = cycle_count;
+
+  return 0;
 }
 
 
diff --git a/avr.h b/avr.h
index 9f46da86..489439e2 100644
--- a/avr.h
+++ b/avr.h
@@ -167,7 +167,7 @@ void avr_mem_display(char * prefix, FILE * f, AVRMEM * m, int type,
 
 void avr_display(FILE * f, AVRPART * p, char * prefix, int verbose);
 
-int avr_get_cycle_count(int fd, AVRPART * p);
+int avr_get_cycle_count(int fd, AVRPART * p, int * cycles);
 
 int avr_put_cycle_count(int fd, AVRPART * p, int cycles);
 
diff --git a/main.c b/main.c
index 93b8d804..a476bb8b 100644
--- a/main.c
+++ b/main.c
@@ -115,7 +115,7 @@ char ** modules[N_MODULES] = {
   &term_version 
 };
 
-char * version      = "2.1.3";
+char * version      = "2.1.4";
 
 char * main_version = "$Id$";
 
@@ -909,8 +909,8 @@ int main(int argc, char * argv [])
   }
 
   if (set_cycles != -1) {
-    cycles = avr_get_cycle_count(fd, p);
-    if (cycles != -1) {
+    rc = avr_get_cycle_count(fd, p, &cycles);
+    if (rc == 0) {
       /*
        * only attempt to update the cycle counter if we can actually
        * read the old value
@@ -943,11 +943,11 @@ int main(int argc, char * argv [])
      * repeat it if an erase was done.  Also, don't display this if we
      * set the cycle count (due to -Y).
      *
-     * see if the cycle count in the last two bytes of eeprom seems
+     * see if the cycle count in the last four bytes of eeprom seems
      * reasonable 
      */
-    cycles = avr_get_cycle_count(fd, p);
-    if ((cycles != -1) && (cycles != 0x00ffff)) {
+    rc = avr_get_cycle_count(fd, p, &cycles);
+    if ((rc >= 0) && (cycles != 0xffffffff)) {
       fprintf(stderr,
               "%s: current erase-rewrite cycle count is %d%s\n",
               progname, cycles,