Various fixes to the code to get it working again.  It looks like the latest version if working reliably and that the new 'initalize only once' code in decoder.cpp is good.