Small fixes related to templates