Prevent ArrayOutOfBounds exception on idForPosition