add vld and resolve memory leak