fix bug in hgen. Add varible declare