finally get the decoding working