Support for scattering relation unions
Fix overfow write in utility function