templates being read correctly. now a condition is added in case there are less stored templates than espected