Fix as_group call

And also add test class for `as_group`