Fixing some tests. Rethrowing error if there is no supplied endTemplate function