add code raising exceptions for index out of bounds