fixed hook to work for check_token/code, resolves #2