fix some problems with  template