bug 676: maxloc - finally got something working