fix several issues for code generator
fix several issues for code generator

Yijtx/npoi,tkalubi/npoi-1,antony-liu/npoi,tonyqus/npoi,vinod1988/npoi,akrisiun/npoi,JesseQin/npoi,jcridev/npoi,xl1/npoi,stuartwmurray/npoi