Avoid two-layers of pattern matchin in `union` (#537)