diff --git a/poky/meta/classes/sstate.bbclass b/poky/meta/classes/sstate.bbclass
index b604729..1122222 100644
--- a/poky/meta/classes/sstate.bbclass
+++ b/poky/meta/classes/sstate.bbclass
@@ -329,7 +329,7 @@
         pstaging_fetch(sstatefetch, d)
 
     if not os.path.isfile(sstatepkg):
-        bb.note("Staging package %s does not exist" % sstatepkg)
+        bb.note("Sstate package %s does not exist" % sstatepkg)
         return False
 
     sstate_clean(ss, d)
@@ -340,7 +340,8 @@
     if bb.utils.to_boolean(d.getVar("SSTATE_VERIFY_SIG"), False):
         signer = get_signer(d, 'local')
         if not signer.verify(sstatepkg + '.sig'):
-            bb.warn("Cannot verify signature on sstate package %s" % sstatepkg)
+            bb.warn("Cannot verify signature on sstate package %s, skipping acceleration..." % sstatepkg)
+            return False
 
     # Empty sstateinst directory, ensure its clean
     if os.path.exists(sstateinst):
@@ -658,8 +659,12 @@
     if d.getVar('SSTATE_SKIP_CREATION') == '1':
         return
 
+    sstate_create_package = ['sstate_report_unihash', 'sstate_create_package']
+    if d.getVar('SSTATE_SIG_KEY'):
+        sstate_create_package.append('sstate_sign_package')
+
     for f in (d.getVar('SSTATECREATEFUNCS') or '').split() + \
-             ['sstate_report_unihash', 'sstate_create_package', 'sstate_sign_package'] + \
+             sstate_create_package + \
              (d.getVar('SSTATEPOSTCREATEFUNCS') or '').split():
         # All hooks should run in SSTATE_BUILDDIR.
         bb.build.exec_func(f, d, (sstatebuild,))
@@ -750,6 +755,11 @@
 sstate_create_package () {
 	TFILE=`mktemp ${SSTATE_PKG}.XXXXXXXX`
 
+	# Exit earlu if it already exists
+	if [ -e ${SSTATE_PKG} ]; then
+		return
+	fi
+
         # Use pigz if available
         OPT="-czS"
         if [ -x "$(command -v pigz)" ]; then
@@ -769,19 +779,24 @@
 		tar $OPT --file=$TFILE --files-from=/dev/null
 	fi
 	chmod 0664 $TFILE
-	mv -f $TFILE ${SSTATE_PKG}
+	# Skip if it was already created by some other process
+	if [ ! -e ${SSTATE_PKG} ]; then
+		mv -f $TFILE ${SSTATE_PKG}
+	else
+		rm $TFILE
+	fi
 }
 
 python sstate_sign_package () {
     from oe.gpg_sign import get_signer
 
-    if d.getVar('SSTATE_SIG_KEY'):
-        signer = get_signer(d, 'local')
-        sstate_pkg = d.getVar('SSTATE_PKG')
-        if os.path.exists(sstate_pkg + '.sig'):
-            os.unlink(sstate_pkg + '.sig')
-        signer.detach_sign(sstate_pkg, d.getVar('SSTATE_SIG_KEY', False), None,
-                           d.getVar('SSTATE_SIG_PASSPHRASE'), armor=False)
+
+    signer = get_signer(d, 'local')
+    sstate_pkg = d.getVar('SSTATE_PKG')
+    if os.path.exists(sstate_pkg + '.sig'):
+        os.unlink(sstate_pkg + '.sig')
+    signer.detach_sign(sstate_pkg, d.getVar('SSTATE_SIG_KEY', False), None,
+                       d.getVar('SSTATE_SIG_PASSPHRASE'), armor=False)
 }
 
 python sstate_report_unihash() {
@@ -808,29 +823,26 @@
 
 BB_HASHCHECK_FUNCTION = "sstate_checkhashes"
 
-def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False, *, sq_unihash=None):
-
-    ret = []
-    missed = []
+def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, **kwargs):
+    found = set()
+    missed = set()
     extension = ".tgz"
     if siginfo:
         extension = extension + ".siginfo"
 
     def gethash(task):
-        if sq_unihash is not None:
-            return sq_unihash[task]
-        return sq_hash[task]
+        return sq_data['unihash'][task]
 
     def getpathcomponents(task, d):
         # Magic data from BB_HASHFILENAME
-        splithashfn = sq_hashfn[task].split(" ")
+        splithashfn = sq_data['hashfn'][task].split(" ")
         spec = splithashfn[1]
         if splithashfn[0] == "True":
             extrapath = d.getVar("NATIVELSBSTRING") + "/"
         else:
             extrapath = ""
-
-        tname = sq_task[task][3:]
+        
+        tname = bb.runqueue.taskname_from_tid(task)[3:]
 
         if tname in ["fetch", "unpack", "patch", "populate_lic", "preconfigure"] and splithashfn[2]:
             spec = splithashfn[2]
@@ -839,18 +851,18 @@
         return spec, extrapath, tname
 
 
-    for task in range(len(sq_fn)):
+    for tid in sq_data['hash']:
 
-        spec, extrapath, tname = getpathcomponents(task, d)
+        spec, extrapath, tname = getpathcomponents(tid, d)
 
-        sstatefile = d.expand("${SSTATE_DIR}/" + extrapath + generate_sstatefn(spec, gethash(task), d) + "_" + tname + extension)
+        sstatefile = d.expand("${SSTATE_DIR}/" + extrapath + generate_sstatefn(spec, gethash(tid), d) + "_" + tname + extension)
 
         if os.path.exists(sstatefile):
             bb.debug(2, "SState: Found valid sstate file %s" % sstatefile)
-            ret.append(task)
+            found.add(tid)
             continue
         else:
-            missed.append(task)
+            missed.add(tid)
             bb.debug(2, "SState: Looked for but didn't find file %s" % sstatefile)
 
     mirrors = d.getVar("SSTATE_MIRRORS")
@@ -880,7 +892,7 @@
             thread_worker.connection_cache.close_connections()
 
         def checkstatus(thread_worker, arg):
-            (task, sstatefile) = arg
+            (tid, sstatefile) = arg
 
             localdata2 = bb.data.createCopy(localdata)
             srcuri = "file://" + sstatefile
@@ -892,22 +904,22 @@
                             connection_cache=thread_worker.connection_cache)
                 fetcher.checkstatus()
                 bb.debug(2, "SState: Successful fetch test for %s" % srcuri)
-                ret.append(task)
-                if task in missed:
-                    missed.remove(task)
+                found.add(tid)
+                if tid in missed:
+                    missed.remove(tid)
             except:
-                missed.append(task)
+                missed.add(tid)
                 bb.debug(2, "SState: Unsuccessful fetch test for %s" % srcuri)
                 pass
             bb.event.fire(bb.event.ProcessProgress(msg, len(tasklist) - thread_worker.tasks.qsize()), d)
 
         tasklist = []
-        for task in range(len(sq_fn)):
-            if task in ret:
+        for tid in sq_data['hash']:
+            if tid in found:
                 continue
-            spec, extrapath, tname = getpathcomponents(task, d)
-            sstatefile = d.expand(extrapath + generate_sstatefn(spec, gethash(task), d) + "_" + tname + extension)
-            tasklist.append((task, sstatefile))
+            spec, extrapath, tname = getpathcomponents(tid, d)
+            sstatefile = d.expand(extrapath + generate_sstatefn(spec, gethash(tid), d) + "_" + tname + extension)
+            tasklist.append((tid, sstatefile))
 
         if tasklist:
             msg = "Checking sstate mirror object availability"
@@ -928,38 +940,37 @@
             bb.event.fire(bb.event.ProcessFinished(msg), d)
 
     # Likely checking an individual task hash again for multiconfig sharing of sstate tasks so skip reporting
-    if len(sq_fn) == 1:
-        return ret
+    if len(sq_data['hash']) == 1:
+        return found
 
     inheritlist = d.getVar("INHERIT")
     if "toaster" in inheritlist:
         evdata = {'missed': [], 'found': []};
-        for task in missed:
-            spec, extrapath, tname = getpathcomponents(task, d)
-            sstatefile = d.expand(extrapath + generate_sstatefn(spec, gethash(task), d) + "_" + tname + ".tgz")
-            evdata['missed'].append( (sq_fn[task], sq_task[task], gethash(task), sstatefile ) )
-        for task in ret:
-            spec, extrapath, tname = getpathcomponents(task, d)
-            sstatefile = d.expand(extrapath + generate_sstatefn(spec, gethash(task), d) + "_" + tname + ".tgz")
-            evdata['found'].append( (sq_fn[task], sq_task[task], gethash(task), sstatefile ) )
+        for tid in missed:
+            spec, extrapath, tname = getpathcomponents(tid, d)
+            sstatefile = d.expand(extrapath + generate_sstatefn(spec, gethash(tid), d) + "_" + tname + ".tgz")
+            evdata['missed'].append((bb.runqueue.fn_from_tid(tid), bb.runqueue.taskname_from_tid(tid), gethash(tid), sstatefile ) )
+        for tid in found:
+            spec, extrapath, tname = getpathcomponents(tid, d)
+            sstatefile = d.expand(extrapath + generate_sstatefn(spec, gethash(tid), d) + "_" + tname + ".tgz")
+            evdata['found'].append((bb.runqueue.fn_from_tid(tid), bb.runqueue.taskname_from_tid(tid), gethash(tid), sstatefile ) )
         bb.event.fire(bb.event.MetadataEvent("MissedSstate", evdata), d)
 
     # Print some summary statistics about the current task completion and how much sstate
     # reuse there was. Avoid divide by zero errors.
-    total = len(sq_fn)
-    currentcount = d.getVar("BB_SETSCENE_STAMPCURRENT_COUNT") or 0
+    total = len(sq_data['hash'])
     complete = 0
     if currentcount:
-        complete = (len(ret) + currentcount) / (total + currentcount) * 100
+        complete = (len(found) + currentcount) / (total + currentcount) * 100
     match = 0
     if total:
-        match = len(ret) / total * 100
-    bb.plain("Sstate summary: Wanted %d Found %d Missed %d Current %d (%d%% match, %d%% complete)" % (total, len(ret), len(missed), currentcount, match, complete))
+        match = len(found) / total * 100
+    bb.plain("Sstate summary: Wanted %d Found %d Missed %d Current %d (%d%% match, %d%% complete)" % (total, len(found), len(missed), currentcount, match, complete))
 
     if hasattr(bb.parse.siggen, "checkhashes"):
-        bb.parse.siggen.checkhashes(missed, ret, sq_fn, sq_task, sq_hash, sq_hashfn, d)
+        bb.parse.siggen.checkhashes(sq_data, missed, found, d)
 
-    return ret
+    return found
 
 BB_SETSCENE_DEPVALID = "setscene_depvalid"
 
