Fix warnings accessing instance variables in templates