Fix for null pointer when token is not found