Sods law - the debug makes it work. Reduce the amount of debug - could calling available() be why it now worked?