[bugfix] fixed the decoding function where it may fail when having two trailing paddings