Getting subgroup from group

I would like to get a subgroup as a groupItem from a group, however i get this error

2017-11-02 07:41:58.109 [INFO ] [e.smarthome.model.script.time of day] - G is now Group_SetPoint_PreHeat
2017-11-02 07:41:58.114 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'State Heating Rule': The name '<XFeatureCallImplCustom>.members' cannot be resolved to an item or type

Here is my simple code:

    val todGroup= Group_SetPoint.members.findFirst[g |"Group_SetPoint_PreHeat"]
            logInfo(logName, "G is now " + )
            // Get the setpoint name for this TOD, fails!!!!!
    		todGroup.members.forEach[sptod |
                logInfo(logName, "sptod is now " + )

The problem is that todGroup is obviously not a groupItem, so how can i change this?

val todGroup = Group_SetPoint.members.findFirst[g |"Group_SetPoint_Preheat"] as GroupItem

This will, of course, fail with an error if g isn’t a Group. I’m not certain where an error will occur if there is no Group_SetPoint_Preheat in the Group_SetPoint.