Are you using the latest release, i.e. 0.4.1, and could you update if you use an older release, e.g. 0.4.0?
You get the correct results, if you comment out line 27?
Just to be clear: I just copied your code without any commenting and ran the script.
Should I change something to see the issue?