This fixes the subscript problems-- only for midshaft.csa.function in this version. Need to fix all other functions