Fixed union type issue and tests added for this case