properly extract token