fixed undo issue with variable inputs