fixed memory leaks in quad batch