Fix bug invalidating tokens