Fixes NPE issue in the union iterator