added memory fix for opencv