MRI synchronization speeding up stimuli

Dear PsychoPy Team,

I programmed a task (files attached) in version 2020.2.8 (Windows 7; 64 bits). I started with the builder and then I compiled it to the coder version.
The task runs perfectly but, as soon as I synchronize the task with the MRI scan trigger, the task starts after the first trigger but then it runs faster and does not show some of the images (aprox. 4 min time difference with and without trigger synchronization).
I thought the task was reading the trigger as button presses, but, despite the fact that the task collects participants’ answers, it does not depend on them to proceed.
Do you have any idea of what may be happening?
I tried with the latest PsychoPy version but I got the same issue. We have other previous tasks with the same version that seem to be working well. (716 Bytes)
congruente.xlsx (18.3 KB) (15.8 KB)
incongruente.xlsx (18.3 KB) (2.7 KB)

Thank you very much.

I solved the issue, it was a mix of two errors: ending the routine after a button press and reading the MRI trigger input as a button press.