diff --git a/ChangeLog b/ChangeLog
index 7109e5a4..a1b26f85 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-08-30  Joerg Wunsch <j.gnu@uriah.heep.sax.de>
+
+	bug #39893: Verification failure with AVRISPmkII and Xmega
+	* stk500v2.c (stk600_xprog_page_erase): Fix argument that is
+	passed to stk600_xprog_memtype()
+
 2013-07-11  Joerg Wunsch <j.gnu@uriah.heep.sax.de>
 
 	* fileio.c (elf2b): replace elf_getshstrndx() by
diff --git a/NEWS b/NEWS
index fc21a494..3f43bda1 100644
--- a/NEWS
+++ b/NEWS
@@ -80,6 +80,7 @@ Current:
       - bug #37942: Latest SVN can't program in dragon_jtag mode
       - patch #7876 JTAGICE mkII fails to connect to attiny if debugwire
         is enabled AND target has a very slow clock
+      - bug #39893: Verification failure with AVRISPmkII and Xmega
 
   * Keep track of input file contents
 
diff --git a/stk500v2.c b/stk500v2.c
index a9ac44c6..1a730c81 100644
--- a/stk500v2.c
+++ b/stk500v2.c
@@ -4313,7 +4313,7 @@ static int stk600_xprog_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
     unsigned char b[6];
 
     if (strcmp(m->desc, "flash") == 0) {
-      b[1] = stk600_xprog_memtype(pgm, addr - m->offset) == XPRG_MEM_TYPE_APPL?
+      b[1] = stk600_xprog_memtype(pgm, addr) == XPRG_MEM_TYPE_APPL?
         XPRG_ERASE_APP_PAGE: XPRG_ERASE_BOOT_PAGE;
     } else if (strcmp(m->desc, "application") == 0 ||
                strcmp(m->desc, "apptable") == 0) {