Changed int cast to NSInteger, closes #22