Unfortunately v2017 changes the way references can be got and reused.
A few pointers...
Use: entities = model.**active_**entities
Also you can 'grep' to filter many kinds of 'collections' thus:
puts face = entities.grep(Sketchup::Face)[0] return nil unless face
The 'face' reference is lost in v2017 after the 'explode', instead consider this...
group.explode puts face = group2.explode.grep(Sketchup::Face)[0]
Now 'face' is a different, but valid, reference...
I added the 'puts' to print the references in the Ruby Console.
In < v2017 they should be the same, but in v2017 they will differ.
This issue has meant that many authors have had to recode some of their plugins to accommodate the changes...
A