memory leak fix
betta version