fixes 'can't allocate region' malloc error