Use _this from closure as this is undefined in script environment, fixes #172.