fix bugs for output var