potential fix of out-of-bounds issue