Fixed issue with undo failing