add out of range check