Revert "Revert "Fix SQM""

This reverts commit 8c132442868a56ec912a38a8ccf37a3d0bedfdfc.