fixed memory leak at line crypto.cpp:133
clean template version