Fixed a bug in the token cleaning mechanism