added more encoding and syntax fixes in the conversion