Updated undo redo
Fixed out of range