fixed bug in template content ordering
more tests