Token-aware tests and fixes