fix bugs for converted code