Adding error handling when token gets corrupted