correctly tokenizing variable expansion