properly handle unions