fixed two memleaks