Adopt slightly altered behavior from krypt-core-c. Set references to null instead of freeing them -> no single Template should be referenced twice.