Jot's worm touched that wall 2 times as Chelsea already said:
1) Before using the rope the worm walked under the wall and, as you can see in this image
height of the worm's sprite is exactly the same, so he touched the wall with his head.
2) The worm also touched the wall when he was using the rope. Here you can watch the .gif in slow motion:
Don' ask me why I did so, I just had some free time xD