Fix Runtime out of range error.