Fix snapshots

Change-Id: Ib3891704ece2cea0c5a80b468b2514e6c4d13216
diff --git a/arch_init.c b/arch_init.c
index b966d8a..7285d27 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -382,7 +382,7 @@
         addr &= TARGET_PAGE_MASK;
 
         if (flags & RAM_SAVE_FLAG_MEM_SIZE) {
-            if (version_id == 3) {
+            if (version_id != 3) {
                 if (addr != ram_bytes_total()) {
                     return -EINVAL;
                 }
@@ -418,13 +418,11 @@
                     total_ram_bytes -= length;
                 }
             }
-        }
-
-        if (flags & RAM_SAVE_FLAG_COMPRESS) {
+        } else if (flags & RAM_SAVE_FLAG_COMPRESS) {
             void *host;
             uint8_t ch;
 
-            if (version_id == 3)
+            if (version_id != 3)
                 host = qemu_get_ram_ptr(addr);
             else
                 host = host_from_stream_offset(f, addr, flags);
@@ -443,7 +441,7 @@
         } else if (flags & RAM_SAVE_FLAG_PAGE) {
             void *host;
 
-            if (version_id == 3)
+            if (version_id != 3)
                 host = qemu_get_ram_ptr(addr);
             else
                 host = host_from_stream_offset(f, addr, flags);