How to Handle with Slopes

I’m currently making a 2d platformer, and I’m having some problem handling slopes.
I’m checking whether my character is on a flat surface or on the platform by using raycast shooting down from the player’s feet position.
It seems to work fine, and nothing goes wrong with it.
But I found few problems and I really couldn’t find any clue to solve these.
First problem is that the characters bounces up when there is a drastic change in the angle.
So I wrote a code like below.

private void FixedUpdate()
{
        if (isOnSlope)
        {
            workSpace.Set(-player.detection.slopePerpNormal.x, -inputX * player.detection.slopePerpNormal.y);
            // slopePerpNormal = Vector2.Perpendicular(hit.normal).normalized
            // this vector always points to the left side(?) of the slope no matter where you are facing
            player.movement.SetVelocity(workSpace, playerData.moveSpeed);
            // SetVelocity function sets the player's velocity to given angle and move speed towards his current facing direction
        }
        else
        {
            player.movement.SetVelocityX(inputX * playerData.moveSpeed);
            player.movement.SetVelocityY(0.0f);
            // SetVelocityX/Y simply sets the character's velocity x or y velocity to given value
        }
}

It improved the movement a lot and works well in low speed but still sometimes the character bounces off the slope when he is dashing.
Is there any way to perfectly make the character stick to the ground?

Second problem is, when the character jumps on the slope, he slides down a little bit. It changes the velocity to zero when it goes to idle state, but still he slides down. Is there any way that can prevent this from happening?

Thank you in advance.

The reason for this were two things.
One is that the collider I used for ground detecting had too short y-axis length, so didn’t have enough frames to change the velocity to 0 before the player touches the slope.
This fixed the problem about 50%, but still there was a problem of my character sliding down the slope when landing, and this comes to the second reason.
The second reason is that I was using Finite State Machine based player controller and was changing the player’s y velocity when entering idle state. It caused a problem because changing between states is not done in a single frame after detecting the ground. So I added a code changing the player’s y-axis velocity to zero when the player is detecting slope(without it causes player landing on normal surface wonky) and its y velocity is below 0 in FixedUpdate.
Though rarely my character still slides down the slope, but I managed to fix it about 90%.
I hope somebody gets help from this thread.