Error in Pavlovia (NaN in output)

Hi everybody! I created a Wisconsin Card Sorting Task using the Builder View.
Brief description: The WCST consists of two card packs having four stimulus cards and 64 response cards in each.
The WCST task is to classify cards, which differ by three criteria: color, shape, or number of the designs on the face of the cards, with the experimenter changing the criterion used after the participant makes 10 consecutive correct classifications.
The experiment ends when participants correctly classify cards by 6 criteria in this order: color, shape, number, color, shape, number or when participants finish the card packs (two packs of 64 cards).

The experiment is working perfectly in Psychopy but in Pavlovia, the code for changing rule doesn’t work till the participant makes an error (in the output file: key_resp.corr=1, n_consecutive =NaN).
When the participant makes the first error (key_resp.corr=0, n_consecutive =0), then it starts to work perfectly and to count correctly the cards in order to change rule (from color to shape) after 10 consecutive correct responses.
Any advise for my problem in Pavlovia? Thank you so much.

I put codes here so If anybody needs a Wisconsin Card Sorting Task, here is all the code needed.
In the Begin Experiment: key_resp.counter=0