Return node failed to cast as game mode

So, my function worked fine until today. Today I changed my game mode from essentially the default game mode to where it now has a variable in it. For whatever reason, this change caused an error in one of my functions. It doesn’t make much sense to me, since (as far as I can see) there is no casting involved in the operation. I will try reworking the code later to see if it can be fixed, but this is what the code that’s producing the error looks like:

The return node is connected directly to the actor spawning, so why is there an error with the game mode and failing to reference the actor?

Okay, I solved the problem. The error was occurring earlier in my code. When I changed it so my variables are held in the game mode, I just replaced the nodes I had when I did it the other way, but I didn’t realize that when I did this I used an actor from my variable before the game mode cast had executed, which was what resulted in the error. It is fixed now. To clarify what I mean, this is a picture of it now:

Previously, the game mode cast was after set actor location, resulting in the error. Everything is fixed now.