fixed bug with scratchpad patching