Correct editing variable behavior

Address the issue #59.  This commit should have all desired behaviors
when editing and deleting variable.