fixed potential ref count problem
Merge branch 'master' of https://github.com/Lundar/IIAG-Script