jumping and landing awkwardly

I have been working on a minecraft clone, but when I jump and land the avatar jumps to the side very quickly. to demonstrate the reason why I made two animations.
Animation 1
The spheres are handled by a colisionhandlerpusher, and the ray is handled by a collisionhandlergravity.
I put bitmasks on everything so that the ray can only collide with the upward-facing faces, and the spheres can only collide with the faces that are facing to the side, like walls.
The player will land sort of on the edge so that it isn’t detected by the collisionray, the top of the wall hits the collisionsphere, causing the player to jump to the side.
Is there any way to achieve something closer to what happens in animation 2?
Animation 2

Hmm… I’m not sure that this will work–I’ve not tried it myself, I don’t think–but perhaps this might work: Have a secondary ground-ray keeping the character out of the ground. Use an intangible CollisionSphere to detect edges such as you describe, and then place the secondary ray above the highest such collision in a given frame (leaving it in place if there are no such collisions, I suppose).