Handle properly invalid tokens. Fixes #3.