bug fixes when translating result set containing UNION