fix a memory leak problem with buildgammadot0