I now fixed the problem with the dialog box, the state machine was to be used for debugging and I will remove it in the final version