cast to int when necessary for subscripts