Fixed issue with "to" parameter and the IO object.

Check for undefined and null in IO.Write.