improve template static checking