Fix toJSON/toSVG serialization when there's active group on canvas. Closes #645