Decoding is working but has some bugs