This should be easy, right?

I hope you can help me because I’ve spend a few days on this and i’m getting nowhere.
I’ve copied an example from SmartThings documentation to allow the user to select a list of modes (required to detect change of mode and not which mode this SmartApp runs in):

input(“modes”, “mode”, title: “Which mode(s)”, multiple: true, require: true)

When testing using the IDE Simlutor I can select the modes that I require but the modes variable is always == null.

So I published the app for me and ran it on my mobile phone. Using notifications (is there a better way to record logs when debugging on mobile?) modes correctly shows as [Night, Home] but then following code fails…

modes.any {it.name == evt.value}

or if I change it to…

modes?.find{it.name == evt.value}

Both examples fail with error: groovy.lang.MissingPropertyException: No such property name for class…
If I change the code by replacing it.name with just it , as follows, then it works as expected:

modes.any {it == evt.value}

Please help me save my hair, not much left to pull out. What am I doing wrong here:
Thanks for your help.