more robust template file check #103