fixing before spy assertions
(cherry-picked from df3c73f)