Updated convert function.

Updated convert function.