fix mem leak at build time