ModI fixes

changed cvt in modI to be double-->int; added int to double conversion
for max value to jump to modI