template fixing nested problems