Fix STO bug

I was improperly creating the new image, which would lead to undefined
errors on the next iteration after a STO command