Avoid NSRangeException when dealing with NSArray