Fix undefined group bounding box

This is an attempt to fix #3879.