Fix some bugs in decoder, still some testing code in place, looking for the next bug