fixing template bugs