It was being checked as a bool but was returning int.
Merge pull request #1617 from jimis/varfix2

It was being checked as a bool but was returning int.