CollisionFlags.CollidedBelow alternating value

Hello, this may be a silly question, as I’m sure everybody has gone trhu it.
Thing is, I have this function:

function is_grounded()
{return (collisionFlags & CollisionFlags.CollidedBelow);	}

But the value it returns with my character is in fact grounded alternates between true and false wildly and rapidly. I know it might be an issue with how the automatic collision works on unity, but I still didn’t find a clean and short solution to this issue.
What’s what works best for you?

Hi! Almost forgot about this. I actually solved it some time ago by making the movement script have a default downwards movement, rather than being still in place. Since it uses a charactercontroller it can’t go trough the floor, and even if the floor has an irregular surface, the character will stick to it as long as he’s not basically falling off a cliff. A good value I’ve found is -0.75*Time.deltaTime on the y component. Learnt that and a lot of other cool stuff by reverse-ingeneering the ‘FPSWalker Enhanced’