Fixed int to NSUInteger for 64 bit arch

Fixes severe bug on iPhone 5S and higher and iPad Air, caused by using int instead of NSUInteger.