Fixed massive memory leak problem with vision code