fix: created elements are not grouped

Hi,

I found this minor bug. Could you review it and merge if it is OK?

Thank you in advance

Péter