mbk, can you add m_scratchpad.clear(); at the beginning of the get_whole_scratchpad function. if the miner gets to a point where it wants to download the whole scratchpad again, it just appends instead of starts over.
Also, on my nvidia card it crashes because difficulty is zero at the start and it divides by that. I just put put a check for if zero, set to something else and it doesn't happen again.