Fix variable completion bug.
Minor improvements.