Fix crash when Undoing in the sandbox

Change-Id: Ica0160a218f9913ba200d99b48c8d5643681f385