attempted fix for buffer overflow in classencoder