fixes buggy cancel action. as a bonus, also fixes tests