Solved problem with invalid template and added an integration test