Some corrections - was hanging on retry after power down (oops)

Hey,

Unfortunately there were a couple of issues with the previous version... here's a fix!

I'm off for a couple of weeks now, but will get onto the optical pulses later..

cheers,

D.