Fixed some leaks in generators