added check if template exists, and aff fallback to index.html