Fixed parse_tag and parse_var

Now everything seems to work fine. The output code very noisy, though...