added check for indices within look up table