Attempting to fix mallocs