some leaks fixing.

VS TESTED ONLY