fixed bug in checkToken, added debugflag in config