Quick patch to try to prevent miner crash when server sends bad scratchpad.  I will follow this up with an overall robustness-increasing pass soon.