Prevent out of bounds errors.