make template more robust