If you stand on an edge of a block with sneaken, you have not the NBT OnGround:1b
I hope you understand, if not ask just in the comments please. Thx