Fixed some cases which did not work when used in templates