Properly convert complex return types.

Attached tests.