So, do you understand why it supposedly works on one line and not the other?

I certainly would not use code that I don't understand. When you adopt code you don't understand, it has a way of turning and biting you.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.