To troubleshoot the problem yourself, you could build up the decode bit by bit, or break it up to assess the output of each bit.
I was also just wondering why you might be using a while loop to do this? See the second post on this thread.
Darth Services (BOB member since 2007-11-20)