The script looks ok at first glance. Maybe it is an issue with the IB plugin. I've forwarded this to the developers for looking into the problem.