add templates and fix bug with model/collection mixup