fix buffer overflow in cioloop