Include file extension in template cache. May fix #798