fixed the template write r not to create file when the problem does not found