You are right. The code is broken. As of now, there is a work around for this issue and the solution is described here.
I have tested it myself and it worked for me.
If you feel the answer is useful, please upvote it. Thanks!