got rid of extraneous casts before indexing