fixed hook to work for check_token/code