Fix getindexim when dimensionality changes (trailing ones dims issue)
Don't run which on Windows