Thread leak fix