fix segfault due to releasing cpg model after initialization