added atomic scratchpad updating