Fixed mmeory leak