Fix unioning more than 1 query
Merge pull request #2559 from maddhatter/fix-multi-unions

[4.0] Fix unioning more than 1 query