fix leak & bug