'ntokens' behaves differently in the presence of 'periodic'
replace 'fromJust' with 'maybe (error ...) id'