Coded forced end of routine ends routine immediately

Hi!
I’m trying to end my routine after two key presses have been made. I’m doing it in the builder with additional code elements. I cannot use the built-in “force end of routine” of the keyboard component because the correct order of keyboard presses changes.

Here is my code:

if mt_follow == 'yes':
    if mt_word_key_resp.keys != None and mt_face_key_resp.keys != None:
        continueRoutine = False
    elif mt_first_task == 'word' and mt_word_key_resp.keys == None and mt_face_key_resp.keys != None:
        continueRoutine = False
    elif mt_first_task == 'face' and mt_face_key_resp.keys == None and mt_word_key_resp.keys != None:
        continueRoutine = False
#    else:
#        continueRoutine = True

So far, what happens is that the routine ends immediately. Not even the stimuli or the fix cross appear. Although they should be up before the keyboard components are even set up. Fix cross starts at 0 ms, stimuli together with the keyboard components.

I made sure that discard previous is checked in both keyboard components.

Has anyone any suggestions? Many thanks in advance!!