[FIX] Test on encoder,decoder and toString. Fix some bugs