trying to fix mem leak