fixed broken template init function