add range check in getXXXAt method